package com.jrzh.mvc.service.sys.impl;

import java.io.Serializable;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.jrzh.common.exception.ProjectException;
import com.jrzh.framework.base.convert.BaseConvertI;
import com.jrzh.framework.base.repository.BaseRepository;
import com.jrzh.framework.base.service.impl.BaseServiceImpl;
import com.jrzh.framework.bean.SessionUser;
import com.jrzh.mvc.convert.sys.MessageChannelConvert;
import com.jrzh.mvc.model.sys.MessageChannelModel;
import com.jrzh.mvc.repository.sys.MessageChannelRepository;
import com.jrzh.mvc.search.sys.MessageChannelSearch;
import com.jrzh.mvc.service.sys.MessageChannelServiceI;
import com.jrzh.mvc.view.sys.MessageChannelView;

@Service("messageChannelService")
public class MessageChannelServiceImpl extends BaseServiceImpl<MessageChannelModel, MessageChannelSearch, MessageChannelView> implements MessageChannelServiceI{
	
	@Autowired
	MessageChannelRepository messageChannelRepository;
	
	@Autowired
	MessageChannelConvert messageChannelConvert;
	
	@Override
	public BaseRepository<MessageChannelModel, Serializable> getDao() {
		return messageChannelRepository;
	}

	@Override
	public BaseConvertI<MessageChannelModel, MessageChannelView> getConvert() {
		return messageChannelConvert;
	}

	@Override
	public void savePushMessage(MessageChannelModel message, SessionUser sessionUser) throws ProjectException {
		this.add(message, sessionUser);
	}

	@Override
	public MessageChannelView getMessage(MessageChannelSearch search) throws ProjectException {
		return this.firstView(search);
	}

	@Override
	public List<MessageChannelView> getMessages(MessageChannelSearch search) throws ProjectException {
		return this.viewList(search);
	}

}
